<template>
  <a-drawer
    title="项目详细信息"
    placement="right"
    :closable="true"
    :maskClosable="true"
    @close="onDrawerClose"
    :visible="visible"
    :width="1024"
    :keyboard="true"
    :getContainer="false">
  </a-drawer>
</template>

<script>
export default {
  name: 'DetailForm',
  props: {
    parentObj: Object
  },
  data () {
    return {
      layout: {
        labelCol: { span: 10 },
        wrapperCol: { span: 12 }
      },
      visible: false,
      loading: false,
      entity: {},
      rules: {},
      title: ''
    }
  },
  methods: {
    init () {
      this.visible = true
      this.entity = {}
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
    },
    openDrawer (id) {
      this.init()
      if (id) {
        this.$http.post('', { id: id }).then(resJson => {
          this.entity = resJson.Data
        })
      }
    },
    onDrawerClose () {
      this.visible = false
    }
  }
}
</script>
